﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_RptXuatChuyenKhoList : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CboDonvi")]
        private ComboBox _CboDonvi;
        [AccessedThroughProperty("CmdCancel")]
        private Button _CmdCancel;
        [AccessedThroughProperty("CmdOK")]
        private Button _CmdOK;
        [AccessedThroughProperty("GroupBox1")]
        private GroupBox _GroupBox1;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Label3")]
        private Label _Label3;
        [AccessedThroughProperty("TxtDenNgay")]
        private DateTimePicker _TxtDenNgay;
        [AccessedThroughProperty("TxtTuNgay")]
        private DateTimePicker _TxtTuNgay;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;

        [DebuggerNonUserCode]
        public Frm_RptXuatChuyenKhoList()
        {
            base.Load += new EventHandler(this.Frm_RptXuatChuyenKhoList_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.InitializeComponent();
        }

        private void CmdCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void CmdOK_Click(object sender, EventArgs e)
        {
            this.PrintXuatChuyenKhoList();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_RptXuatChuyenKhoList_Load(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                BuildComboModule.BuildCombo(this.CboDonvi, modGeneral.ListDanhMuc.DonVi, true, "", "");
                this.CboDonvi.SelectedValue = modGeneral.H_CLIENT;
                this.TxtTuNgay.Text = "01/" + LVYModule.sRight("00" + Conversions.ToString(DateAndTime.Month(DateAndTime.Today)), 2) + "/" + Conversions.ToString(DateAndTime.Year(DateAndTime.Today));
                this.Cursor = Cursors.Default;
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_RptXuatChuyenKhoList));
            this.CmdCancel = new Button();
            this.CmdOK = new Button();
            this.GroupBox1 = new GroupBox();
            this.TxtDenNgay = new DateTimePicker();
            this.TxtTuNgay = new DateTimePicker();
            this.Label2 = new Label();
            this.CboDonvi = new ComboBox();
            this.Label1 = new Label();
            this.Label3 = new Label();
            this.GroupBox1.SuspendLayout();
            this.SuspendLayout();
            this.CmdCancel.DialogResult = DialogResult.Cancel;
            this.CmdCancel.Image = (Image) manager.GetObject("CmdCancel.Image");
            this.CmdCancel.ImageAlign = ContentAlignment.MiddleLeft;
            Point point = new Point(0x11d, 130);
            this.CmdCancel.Location = point;
            this.CmdCancel.Name = "CmdCancel";
            Size size = new Size(0x52, 0x18);
            this.CmdCancel.Size = size;
            this.CmdCancel.TabIndex = 0x3e;
            this.CmdCancel.Text = "&Tho\x00e1t";
            this.CmdCancel.UseVisualStyleBackColor = true;
            this.CmdOK.Image = (Image) manager.GetObject("CmdOK.Image");
            this.CmdOK.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0xca, 130);
            this.CmdOK.Location = point;
            this.CmdOK.Name = "CmdOK";
            size = new Size(0x51, 0x18);
            this.CmdOK.Size = size;
            this.CmdOK.TabIndex = 0x3d;
            this.CmdOK.Text = "&Chọn";
            this.CmdOK.UseVisualStyleBackColor = true;
            this.GroupBox1.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            this.GroupBox1.Controls.Add(this.TxtDenNgay);
            this.GroupBox1.Controls.Add(this.TxtTuNgay);
            this.GroupBox1.Controls.Add(this.Label2);
            this.GroupBox1.Controls.Add(this.CboDonvi);
            this.GroupBox1.Controls.Add(this.Label1);
            this.GroupBox1.Controls.Add(this.Label3);
            point = new Point(4, 5);
            this.GroupBox1.Location = point;
            this.GroupBox1.Name = "GroupBox1";
            size = new Size(0x16c, 0x77);
            this.GroupBox1.Size = size;
            this.GroupBox1.TabIndex = 60;
            this.GroupBox1.TabStop = false;
            this.GroupBox1.Text = "T\x00f9y chọn";
            this.TxtDenNgay.Format = DateTimePickerFormat.Short;
            point = new Point(0xf5, 0x47);
            this.TxtDenNgay.Location = point;
            this.TxtDenNgay.Name = "TxtDenNgay";
            size = new Size(0x5c, 20);
            this.TxtDenNgay.Size = size;
            this.TxtDenNgay.TabIndex = 0x1d;
            this.TxtTuNgay.Format = DateTimePickerFormat.Short;
            point = new Point(0x51, 0x47);
            this.TxtTuNgay.Location = point;
            this.TxtTuNgay.Name = "TxtTuNgay";
            size = new Size(0x58, 20);
            this.TxtTuNgay.Size = size;
            this.TxtTuNgay.TabIndex = 0x1c;
            this.Label2.AutoSize = true;
            this.Label2.BackColor = Color.Transparent;
            point = new Point(0x1d, 0x4b);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x2e, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 0x1a;
            this.Label2.Text = "Từ ng\x00e0y";
            this.CboDonvi.FormattingEnabled = true;
            point = new Point(0x51, 0x26);
            this.CboDonvi.Location = point;
            this.CboDonvi.Name = "CboDonvi";
            size = new Size(0x100, 0x15);
            this.CboDonvi.Size = size;
            this.CboDonvi.TabIndex = 0x19;
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            point = new Point(0x20, 0x2b);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x26, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 0x18;
            this.Label1.Text = "Đơn vị";
            this.Label3.AutoSize = true;
            this.Label3.BackColor = Color.Transparent;
            point = new Point(0xba, 0x4b);
            this.Label3.Location = point;
            this.Label3.Name = "Label3";
            size = new Size(0x35, 13);
            this.Label3.Size = size;
            this.Label3.TabIndex = 0x1b;
            this.Label3.Text = "Đến ng\x00e0y";
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            this.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            size = new Size(0x174, 160);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.CmdCancel);
            this.Controls.Add(this.CmdOK);
            this.Controls.Add(this.GroupBox1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.Name = "Frm_RptXuatChuyenKhoList";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "BC-0025";
            this.Text = "XUAT CHUYEN KHO";
            this.GroupBox1.ResumeLayout(false);
            this.GroupBox1.PerformLayout();
            this.ResumeLayout(false);
        }

        public void PrintXuatChuyenKhoList()
        {
            clsXuatChuyenKho kho = new clsXuatChuyenKho();
            this.Cursor = Cursors.WaitCursor;
            string strCondition = "";
            string str = "";
            strCondition = " XCK.NgayChungTu between '" + LVYModule.Date2Char(this.TxtTuNgay.Text) + "' And '" + LVYModule.Date2Char(this.TxtDenNgay.Text) + "'";
            str = LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboDonvi.SelectedValue), "", modGeneral.TypeOfValue.String).ToString();
            DataTable dataPrintTongHop = kho.GetDataPrintTongHop(strCondition);
            if (dataPrintTongHop != null)
            {
                if (dataPrintTongHop.Rows.Count == 0)
                {
                    LVYModule.ShowWarning(modGeneral.Tranlated("Kh\x00f4ng c\x00f3 dữ liệu!", ""));
                }
                else
                {
                    Rpt_XuatChuyenKList list = new Rpt_XuatChuyenKList();
                    try
                    {
                        list.SetDataSource(dataPrintTongHop);
                        if (modGeneral.H_LANGUAGE == "VIET")
                        {
                            list.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEVIET, ""));
                        }
                        else
                        {
                            list.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEANH, ""));
                        }
                        list.SetParameterValue(1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS);
                        list.SetParameterValue(2, modGeneral.Tranlated("M\x00e3 số thuế", "") + ": " + modGeneral.H_TAXCODE);
                        list.SetParameterValue(3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE);
                        list.SetParameterValue(4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX);
                        list.SetParameterValue(5, modGeneral.Tranlated("BẢNG K\x00ca PHIẾU XUẤT CHUYỂN KHO", ""));
                        list.SetParameterValue(6, modGeneral.Tranlated("Số chứng từ", ""));
                        list.SetParameterValue(7, modGeneral.Tranlated("Ng\x00e0y", ""));
                        list.SetParameterValue(8, modGeneral.Tranlated("Kho xuất", ""));
                        list.SetParameterValue(9, modGeneral.Tranlated("Người nhận", ""));
                        list.SetParameterValue(10, modGeneral.Tranlated("Kho nhập", ""));
                        list.SetParameterValue(11, modGeneral.Tranlated("Người giao", ""));
                        list.SetParameterValue(12, modGeneral.Tranlated("Số tiền", ""));
                        list.SetParameterValue(13, modGeneral.Tranlated("STT", ""));
                        list.SetParameterValue(14, modGeneral.Tranlated("Từ ng\x00e0y", "") + ": " + this.TxtTuNgay.Text + "  " + modGeneral.Tranlated("đến ng\x00e0y", "") + ": " + this.TxtDenNgay.Text);
                        list.SetParameterValue(15, modGeneral.Tranlated("Ng\x00e0y .......... th\x00e1ng .......... năm ....................", ""));
                        list.SetParameterValue(0x10, modGeneral.Tranlated("Lập biểu", ""));
                        MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = list;
                        MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = false;
                        if (Form.ActiveForm != null)
                        {
                            Form.ActiveForm.Cursor = Cursors.Default;
                        }
                        MyProject.Forms.Frm_ViewReport.ShowDialog();
                    }
                    catch (Exception exception1)
                    {
                        ProjectData.SetProjectError(exception1);
                        Exception exception = exception1;
                        MessageBox.Show(exception.Message.ToString());
                        ProjectData.ClearProjectError();
                    }
                }
            }
        }

        private void TxtTuNgay_LostFocus(object sender, EventArgs e)
        {
            if (LVYModule.sRight(this.TxtTuNgay.Text, 7) != LVYModule.sRight(this.TxtDenNgay.Text, 7))
            {
                this.TxtDenNgay.Text = DateTime.DaysInMonth(Conversions.ToInteger(LVYModule.sRight(this.TxtTuNgay.Text, 4)), Conversions.ToInteger(LVYModule.sMid(this.TxtTuNgay.Text, 4, 2))).ToString() + "/" + LVYModule.sRight(this.TxtTuNgay.Text, 7);
            }
        }

        internal virtual ComboBox CboDonvi
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboDonvi;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboDonvi = value;
            }
        }

        internal virtual Button CmdCancel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdCancel_Click);
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click -= handler;
                }
                this._CmdCancel = value;
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click += handler;
                }
            }
        }

        internal virtual Button CmdOK
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdOK;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdOK_Click);
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click -= handler;
                }
                this._CmdOK = value;
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click += handler;
                }
            }
        }

        internal virtual GroupBox GroupBox1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox1 = value;
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Label Label3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label3 = value;
            }
        }

        internal virtual DateTimePicker TxtDenNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtDenNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtDenNgay = value;
            }
        }

        internal virtual DateTimePicker TxtTuNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTuNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.TxtTuNgay_LostFocus);
                if (this._TxtTuNgay != null)
                {
                    this._TxtTuNgay.LostFocus -= handler;
                }
                this._TxtTuNgay = value;
                if (this._TxtTuNgay != null)
                {
                    this._TxtTuNgay.LostFocus += handler;
                }
            }
        }
    }
}

